//
//  OilMarketListCell.m
//  Base_App
//
//  Created by Yutian Duan on 2019/6/24.
//  Copyright © 2019年 Wanwin. All rights reserved.
//

#import "OilMarketListCell.h"

@implementation OilMarketListCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  if (self) {
    self.contentView.backgroundColor = DEF_BgColor;
    [self createViews];
  }
  return self;
}

- (void)createViews {
  
  ///!
  UIView *contentView = [[UIView alloc] init];
  contentView.layer.masksToBounds = YES;
  contentView.layer.cornerRadius = 8;
  contentView.clipsToBounds = YES;
  contentView.backgroundColor = [UIColor whiteColor];
  contentView.layer.borderColor = [UIColor lightGrayColor].CGColor;
  contentView.layer.borderWidth = 0.5;
  [self.contentView addSubview:contentView];
  
  _bgImageView = [[UIImageView alloc] init];
  _bgImageView.contentMode = UIViewContentModeScaleAspectFill;
  [contentView addSubview:_bgImageView];

  _titleLabel = [[UILabel alloc] init];
  _titleLabel.textColor = DEF_BLACK;
  [contentView addSubview:_titleLabel];

  //!
  _noteImageView = [[UIImageView alloc] init];
  _noteImageView.contentMode = UIViewContentModeScaleAspectFit;
  [contentView addSubview:_noteImageView];

  
  ///!
  _noteLabel = [[UILabel alloc] init];
  _noteLabel.font = [UIFont systemFontOfSize:14];
  _noteLabel.textAlignment = NSTextAlignmentLeft;
  _noteLabel.textColor = DEF_GRAY;
  [contentView addSubview:self.noteLabel];

  
  [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.leading.mas_equalTo(self.contentView.mas_leading).offset(20);
    make.top.mas_equalTo(self.contentView.mas_top);
    make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-20);
    make.trailing.mas_equalTo(self.contentView.mas_trailing).offset(-20);
  }];
  
  
  [_bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.leading.trailing.top.mas_equalTo(contentView);
    make.height.mas_equalTo(self.bgImageView.mas_width).multipliedBy(IMAGEPRO);
  }];
  
  [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.leading.mas_equalTo(self.bgImageView.mas_leading).offset(20);
    make.top.mas_equalTo(self.bgImageView.mas_bottom);
    make.width.mas_equalTo(self.bgImageView.mas_width).offset(-40);
    make.height.mas_equalTo(@30);
  }];

  [_noteImageView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.leading.mas_equalTo(self.titleLabel.mas_leading);
    make.top.mas_equalTo(self.titleLabel.mas_bottom);
    make.width.mas_equalTo(@40);
    make.height.mas_equalTo(20);
  }];
  
  [_noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.leading.mas_equalTo(self.noteImageView.mas_trailing).offset(10);
    make.top.mas_equalTo(self.noteImageView.mas_top);
    make.trailing.mas_equalTo(contentView.mas_trailing).offset(-20);
    make.height.mas_equalTo(self.noteImageView.mas_height);
  }];
  
  
  
}

- (void)setupData {
  
  _bgImageView.image = [UIImage imageNamed:@"Home_CarPrice"];
  _titleLabel.text = @"为你推荐会员独家投保计划";
  _noteImageView.image = [UIImage imageNamed:@"Home_timeLimit"];
  _noteLabel.text = @"投保e客户特享受全城至低价格!";

}

@end
